package com.tsll.service.impl;

import com.tsll.dao.DepartmentMapper;
import com.tsll.entity.Department;
import com.tsll.vo.EchartsVo;
import com.tsll.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl implements com.tsll.service.DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;
    @Override
    public Result selectByPrimaryKey(Integer id) {
        Result department = departmentMapper.selectByPrimaryKey(id);
        if (department != null) {
            return new Result(200, "查询左侧菜单成功", department);
        } else {
            return new Result(404, "未找到对应部门", null);
        }
    }

    @Override
    public Result selectAll() {
        List<Department> departments = departmentMapper.selectAll();
        return new Result(200,"查找成功",departments);
    }

    @Override
    public List<EchartsVo> selectname() {
        List<EchartsVo> selectname = departmentMapper.selectname();
        return selectname;
    }
}